const Koa = require('koa');
const config = require('./config');
const router = require('./api');
const middlewares = require('./middlewares');

const app = new Koa();

// 所有中间件设定
middlewares(app);

// 路由设定
app.use(router.routes());

// 启动
app.listen(config.port, () => {
    console.log('server listen on port: ' + config.port);
});